﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZP.DTO.ep_gov_support;
using ZP.IBLL;
using ZP.Model;

namespace ZP.BLL
{
    public class ep_gov_supportService : BaseService<ep_gov_support, int>, Iep_gov_supportService
    {

        public List<ep_gov_supportResultDTO> GetEnterpriseSupportInfo(int ep_id)
        {
            var psie = (ZPJ_Entities)_repository.GetDbContext();
            var iquery = psie.ep_gov_support.AsNoTracking().Where(p => p.ep_id == ep_id).OrderBy(o => o.sort);

            //序列化类型为“System.Data.Entity.DynamicProxies.xxxx”的对象时检测到循环引用。 加上这个就OK了
            psie.Configuration.ProxyCreationEnabled = false;
            List<ep_gov_supportResultDTO> list = AutoMapper.Mapper.Map<List<ep_gov_supportResultDTO>>(iquery.ToList());
            return list;
        }
    }
}
